import numpy as np
import healpy as hp
import matplotlib.pyplot as plt
!pwd
/Users/tony/project_planckVsWMAP
hp.read_map("ffp10_newdust_total_353_full_map.fits") #planckTmap
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:368: UserWarning: If you are not specifying the input dtype and using the default np.float64 dtype of read_map(), please consider that it will change in a future version to None as to keep the same dtype of the input file: please explicitly set the dtype if it is important to you.
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:391: UserWarning: NSIDE = 2048
warnings.warn("NSIDE = {0:d}".format(nside))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:400: UserWarning: ORDERING = RING in fits file
warnings.warn("ORDERING = {0:s} in fits file".format(ordering))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:428: UserWarning: INDXSCHM = IMPLICIT
warnings.warn("INDXSCHM = {0:s}".format(schm))
array([ 2.50327867e-06, -4.45016194e-05, 3.31364572e-05, ...,
-4.48527280e-05, -1.91247091e-05, 2.42725946e-05])
map_sample = hp.read_map("ffp10_newdust_total_030_full_map.fits")
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:391: UserWarning: NSIDE = 1024
warnings.warn("NSIDE = {0:d}".format(nside))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:400: UserWarning: ORDERING = NESTED in fits file
warnings.warn("ORDERING = {0:s} in fits file".format(ordering))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:486: UserWarning: Ordering converted to RING
warnings.warn("Ordering converted to RING")
map_sample #353Hz map
array([-2.71337165e-04, -9.36984798e-05, -2.51075049e-04, ...,
-1.52736000e-04, -1.10948109e-04, -7.72219792e-05])
hp.mollview(
map_sample,
coord=["G", "E"],
title="Histogram equalized Ecliptic Sample 30Hz",
unit="mK",
norm="hist",
min=-0.01,
max=0.01,
)
hp.graticule()
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:920: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_over(newcm(1.0))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:921: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_under(bgcolor)
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:922: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_bad(badcolor)
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:202: MatplotlibDeprecationWarning: Passing parameters norm and vmin/vmax simultaneously is deprecated since 3.3 and will become an error two minor releases later. Please pass vmin/vmax directly to the norm when creating it.
aximg = self.imshow(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:541: UserWarning: 0.0 180.0 -180.0 180.0
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:656: UserWarning: The interval between parallels is 30 deg -0.00'.
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:664: UserWarning: The interval between meridians is 30 deg -0.00'.
warnings.warn(
Beam Maps
import astropy.io.fits as pf
import pylab # only to produce plots
FITSfile = 'BeamWf_HFI_R3.01/Bl_T_R3.01_fullsky_353x353.fits'
pf.info(FITSfile) # print list of extensions found in FITSfile
data, header = pf.getdata(FITSfile, header=True)#, 10, header=True) # read extension #10 (data and header)
#data, header = pf.getdata(FITSfile100, '100', header=True) # read extension having EXTNAME='ABC' (data and header)
print(header) # print header
print(data.names) # print column names
pylab.plot( data.field(0).flatten() ) # plot 1st column of binary table
Filename: BeamWf_HFI_R3.01/Bl_T_R3.01_fullsky_353x353.fits No. Name Ver Type Cards Dimensions Format 0 PRIMARY 1 PrimaryHDU 19 () 1 WINDOW FUNCTION 1 TableHDU 26 4001R x 1C [E15.7] XTENSION= 'TABLE ' / ASCII table extension BITPIX = 8 / array data type NAXIS = 2 / number of array dimensions NAXIS1 = 15 / length of dimension 1 NAXIS2 = 4001 / length of dimension 2 PCOUNT = 0 / number of group parameters GCOUNT = 1 / number of groups TFIELDS = 1 / number of table fields TTYPE1 = 'TEMPERATURE' TFORM1 = 'E15.7 ' TBCOL1 = 1 EXTNAME = 'WINDOW FUNCTION' / extension name MAX-LPOL= 4000 / Maximum L multipole POLAR = F BCROSS = F ASYMCL = F COMMENT ---------------------------------------------------------------- COMMENT Beam Window Function B(l) COMMENT Compatible with Healpix (synfast, smoothing, ...) and PolSpice COMMENT To be squared before applying to power spectrum COMMENT C_map(l) = C_sky(l) * B(l)^2 COMMENT Adapted from COMMENT /redtruck/?????/m3space/quickbeam/quickpol/data/RD12rc3/beam_matrix_353xCOMMENT 353_l4000_s6_A000_cmbfast_0_rbIMO_rhIMO.npz COMMENT by ./qp2fits.py on 2016-06-15 COMMENT ---------------------------------------------------------------- END ['TEMPERATURE']
[<matplotlib.lines.Line2D at 0x143a634c0>]
data
FITS_rec([(1.0,), (0.99999952,), (0.99999863,), ..., (0.068820141,),
(0.068731263,), (0.068642475,)],
dtype=(numpy.record, [('TEMPERATURE', 'S15')]))
#Intensity Map (Planck) - Foreground removed
intensityCMB100 = hp.read_map("COM_CMB_IQU-100-fgsub-sevem-field-Int_2048_R2.01_full.fits")
intensityCMB100
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:368: UserWarning: If you are not specifying the input dtype and using the default np.float64 dtype of read_map(), please consider that it will change in a future version to None as to keep the same dtype of the input file: please explicitly set the dtype if it is important to you.
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:391: UserWarning: NSIDE = 2048
warnings.warn("NSIDE = {0:d}".format(nside))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:400: UserWarning: ORDERING = NESTED in fits file
warnings.warn("ORDERING = {0:s} in fits file".format(ordering))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:426: UserWarning: No INDXSCHM keyword in header file : assume IMPLICIT
warnings.warn("No INDXSCHM keyword in header file : " "assume {}".format(schm))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:428: UserWarning: INDXSCHM = IMPLICIT
warnings.warn("INDXSCHM = {0:s}".format(schm))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/fitsfunc.py:486: UserWarning: Ordering converted to RING
warnings.warn("Ordering converted to RING")
array([-1.34818620e-04, -1.13565744e-04, -5.30425641e-05, ...,
9.37869918e-05, 3.33317512e-05, -2.04297194e-05])
hp.mollview(
intensityCMB100,
coord=["G", "E"],
title="Intensity CMB",
unit="mK",
norm="hist",
min=-0.01,
max=0.01,
)
hp.graticule()
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:920: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_over(newcm(1.0))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:921: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_under(bgcolor)
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:922: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_bad(badcolor)
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:202: MatplotlibDeprecationWarning: Passing parameters norm and vmin/vmax simultaneously is deprecated since 3.3 and will become an error two minor releases later. Please pass vmin/vmax directly to the norm when creating it.
aximg = self.imshow(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:541: UserWarning: 0.0 180.0 -180.0 180.0
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:656: UserWarning: The interval between parallels is 30 deg -0.00'.
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:664: UserWarning: The interval between meridians is 30 deg -0.00'.
warnings.warn(
intensityCMB217 = hp.read_map("COM_CMB_IQU-217-fgsub-sevem-field-Int_2048_R2.01_full.fits")
intensityCMB217
array([-1.45112805e-04, -9.79054021e-05, -8.30674253e-05, ...,
1.03153470e-04, 9.47897715e-05, 8.28015836e-05])
hp.mollview(
intensityCMB217,
coord=["G", "E"],
title="Intensity CMB",
unit="mK",
norm="hist",
min=-0.01,
max=0.01,
)
hp.graticule()
WMAP
!pwd
/Users/tony/project_planckVsWMAP
import healpy as hp
import numpy as np
import os
import astropy.units as u
import matplotlib.pyplot as plt
%matplotlib inline
.
Tool used
!curl "https://irsa.ipac.caltech.edu/data/Planck/release_3/all-sky-maps/maps/component-maps/cmb/COM_CMB_IQU-commander_2048_R3.00_full.fits" -o COM_CMB_IQU-commander_2048_R3.00_full.fits
filename = 'COM_CMB_IQU-commander_2048_R3.00_full.fits'
cmb_map = hp.read_map(filename)
Tool used
!curl "https://irsa.ipac.caltech.edu/data/Planck/release_3/ancillary-data/masks/COM_Mask_CMB-common-Mask-Int_2048_R3.00.fits" -o COM_Mask_CMB-common-Mask-Int_2048_R3.00.fits
#Visualising cmb_map
hp.mollview(cmb_map, min=-1e-3, max=1e-3, title="CMB only temperature map", unit="K")
Observation: There is residual galactic emission we should mask. The contamination just close to the galactic plane, (we could run anafast and specify a few degrees of gal_cut).
#masking with one of the planck masks(earlier loaded)
path = 'COM_Mask_CMB-common-Mask-Int_2048_R3.00.fits'
mask = hp.read_map(path)
map_masked = hp.ma(cmb_map)
map_masked.mask = np.logical_not(mask)
mask
array([1., 1., 1., ..., 1., 1., 1.])
map_masked
masked_array(data=[-0.00014912881306372583, -0.00011455055937403813,
-9.056342241819948e-05, ..., 0.00011307044769637287,
9.498728468315676e-05, 0.00010467269021319225],
mask=[False, False, False, ..., False, False, False],
fill_value=-1.6375e+30)
map_masked.mask
array([False, False, False, ..., False, False, False])
hp.mollview(map_masked, min=-1e-3, max=1e-3)
Now,we can load the binned TT CMB power spectrum:
Tool used
!curl "https://irsa.ipac.caltech.edu/data/Planck/release_3/ancillary-data/cosmoparams/COM_PowerSpect_CMB-TT-binned_R3.01.txt" -o COM_PowerSpect_CMB-TT-binned_R3.01.txt
!head -3 COM_PowerSpect_CMB-TT-binned_R3.01.txt #use of header info?
# l Dl -dDl +dDl BestFit 4.77112240e+01 1.47933552e+03 5.07654876e+01 5.07654876e+01 1.46111304e+03 7.64716065e+01 2.03496833e+03 5.47101576e+01 5.47101576e+01 2.06238073e+03
cmb_binned_spectrum = np.loadtxt('COM_PowerSpect_CMB-TT-binned_R3.01.txt')
cmb_binned_spectrum
array([[4.77112240e+01, 1.47933552e+03, 5.07654876e+01, 5.07654876e+01,
1.46111304e+03],
[7.64716065e+01, 2.03496833e+03, 5.47101576e+01, 5.47101576e+01,
2.06238073e+03],
[1.05917385e+02, 2.95539416e+03, 6.49766440e+01, 6.49766440e+01,
2.90452526e+03],
[1.35605348e+02, 3.86951392e+03, 7.69143744e+01, 7.69143744e+01,
3.90248963e+03],
[1.65405597e+02, 4.88946506e+03, 8.65856259e+01, 8.65856259e+01,
4.86135537e+03],
[1.95266870e+02, 5.46410945e+03, 9.05533459e+01, 9.05533459e+01,
5.53480715e+03],
[2.25164945e+02, 5.79343954e+03, 8.71348811e+01, 8.71348811e+01,
5.72693135e+03],
[2.55086908e+02, 5.37288375e+03, 7.69383697e+01, 7.69383697e+01,
5.37498113e+03],
[2.85025248e+02, 4.62767753e+03, 6.25199141e+01, 6.25199141e+01,
4.58832266e+03],
[3.14975304e+02, 3.60423851e+03, 4.71589439e+01, 4.71589439e+01,
3.59689801e+03],
[3.44934027e+02, 2.63120029e+03, 3.38762191e+01, 3.38762191e+01,
2.66745188e+03],
[3.74899344e+02, 2.03305943e+03, 2.48190562e+01, 2.48190562e+01,
2.01816864e+03],
[4.04869791e+02, 1.75336253e+03, 2.07109083e+01, 2.07109083e+01,
1.74834025e+03],
[4.34844309e+02, 1.78757901e+03, 2.06713695e+01, 2.06713695e+01,
1.82192489e+03],
[4.64822111e+02, 2.16204649e+03, 2.27523861e+01, 2.27523861e+01,
2.09823728e+03],
[4.94802601e+02, 2.42208480e+03, 2.49726104e+01, 2.49726104e+01,
2.39772998e+03],
[5.24785320e+02, 2.57348050e+03, 2.59184118e+01, 2.59184118e+01,
2.57144487e+03],
[5.54769905e+02, 2.54629768e+03, 2.50510538e+01, 2.50510538e+01,
2.55180645e+03],
[5.84756069e+02, 2.36064530e+03, 2.27209283e+01, 2.27209283e+01,
2.36436140e+03],
[6.14743583e+02, 2.09543505e+03, 1.98505488e+01, 1.98505488e+01,
2.10480607e+03],
[6.44732258e+02, 1.88467698e+03, 1.75025264e+01, 1.75025264e+01,
1.89096016e+03],
[6.74721939e+02, 1.81316288e+03, 1.64306044e+01, 1.64306044e+01,
1.81252216e+03],
[7.04712498e+02, 1.88319393e+03, 1.67990643e+01, 1.67990643e+01,
1.89672650e+03],
[7.34703827e+02, 2.09713072e+03, 1.81645476e+01, 1.81645476e+01,
2.10225612e+03],
[7.64695836e+02, 2.31873584e+03, 1.97363538e+01, 1.97363538e+01,
2.33880907e+03],
[7.94688447e+02, 2.46458129e+03, 2.07062220e+01, 2.07062220e+01,
2.50417440e+03],
[8.24681596e+02, 2.52191260e+03, 2.05197620e+01, 2.05197620e+01,
2.52277302e+03],
[8.54675226e+02, 2.39412077e+03, 1.90381031e+01, 1.90381031e+01,
2.37141912e+03],
[8.84669287e+02, 2.08333867e+03, 1.65790348e+01, 1.65790348e+01,
2.08335227e+03],
[9.14663738e+02, 1.74072841e+03, 1.37374917e+01, 1.37374917e+01,
1.73253226e+03],
[9.44658541e+02, 1.41867342e+03, 1.11420483e+01, 1.11420483e+01,
1.40502882e+03],
[9.74653663e+02, 1.17295424e+03, 9.28646475e+00, 9.28646475e+00,
1.17014623e+03],
[1.00464908e+03, 1.06240462e+03, 8.37987000e+00, 8.37987000e+00,
1.05887288e+03],
[1.03464476e+03, 1.04786241e+03, 8.30074773e+00, 8.30074773e+00,
1.05936420e+03],
[1.06464068e+03, 1.13235191e+03, 8.68575434e+00, 8.68575434e+00,
1.12669220e+03],
[1.09463683e+03, 1.21101851e+03, 9.11274984e+00, 9.11274984e+00,
1.20298244e+03],
[1.12463318e+03, 1.23187224e+03, 9.26050628e+00, 9.26050628e+00,
1.23858790e+03],
[1.15462972e+03, 1.20578050e+03, 8.98528122e+00, 8.98528122e+00,
1.20804315e+03],
[1.18462643e+03, 1.11792662e+03, 8.33171031e+00, 8.33171031e+00,
1.11502109e+03],
[1.21462331e+03, 9.68422243e+02, 7.54508665e+00, 7.54508665e+00,
9.86438951e+02],
[1.24462034e+03, 8.64397967e+02, 6.64322644e+00, 6.64322644e+00,
8.59469330e+02],
[1.27461751e+03, 7.61605936e+02, 5.98585735e+00, 5.98585735e+00,
7.66845300e+02],
[1.30461481e+03, 7.32339633e+02, 5.68666086e+00, 5.68666086e+00,
7.25319871e+02],
[1.33461223e+03, 7.37290337e+02, 5.71800485e+00, 5.71800485e+00,
7.31898515e+02],
[1.36460976e+03, 7.74925851e+02, 5.94089388e+00, 5.94089388e+00,
7.67047643e+02],
[1.39460740e+03, 8.06625346e+02, 6.17243469e+00, 6.17243469e+00,
8.03588527e+02],
[1.42460514e+03, 8.09057064e+02, 6.25632882e+00, 6.25632882e+00,
8.16784389e+02],
[1.45460297e+03, 7.77751089e+02, 6.11143430e+00, 6.11143430e+00,
7.92658706e+02],
[1.48460089e+03, 7.28943580e+02, 5.74544667e+00, 5.74544667e+00,
7.31230681e+02],
[1.51459890e+03, 6.48288645e+02, 5.24258624e+00, 5.24258624e+00,
6.44972815e+02],
[1.54459698e+03, 5.51286111e+02, 4.72393254e+00, 4.72393254e+00,
5.52838213e+02],
[1.57459513e+03, 4.76600995e+02, 4.30079600e+00, 4.30079600e+00,
4.73410287e+02],
[1.60459335e+03, 4.19541270e+02, 4.04442416e+00, 4.04442416e+00,
4.18888542e+02],
[1.63459164e+03, 3.95211496e+02, 3.96833591e+00, 3.96833591e+00,
3.92152600e+02],
[1.66458999e+03, 3.91657847e+02, 4.03423921e+00, 4.03423921e+00,
3.87313797e+02],
[1.69458839e+03, 3.92947519e+02, 4.17356282e+00, 4.17356282e+00,
3.93097715e+02],
[1.72458686e+03, 3.97735803e+02, 4.31665510e+00, 4.31665510e+00,
3.97391812e+02],
[1.75458537e+03, 3.83011743e+02, 4.41586492e+00, 4.41586492e+00,
3.91427360e+02],
[1.78458394e+03, 3.75391143e+02, 4.45733427e+00, 4.45733427e+00,
3.71983403e+02],
[1.81458255e+03, 3.40139516e+02, 4.45892926e+00, 4.45892926e+00,
3.41585903e+02],
[1.84458121e+03, 3.07539268e+02, 4.45749277e+00, 4.45749277e+00,
3.06532670e+02],
[1.87457991e+03, 2.73859536e+02, 4.49350451e+00, 4.49350451e+00,
2.74153525e+02],
[1.90457865e+03, 2.49846901e+02, 4.59652807e+00, 4.59652807e+00,
2.50006349e+02],
[1.93457743e+03, 2.44246300e+02, 4.77758093e+00, 4.77758093e+00,
2.36236579e+02],
[1.96457625e+03, 2.31913142e+02, 5.02866666e+00, 5.02866666e+00,
2.31349665e+02],
[1.99457510e+03, 2.34658998e+02, 5.42839879e+00, 5.42839879e+00,
2.31209089e+02],
[2.02457399e+03, 2.31744942e+02, 5.86880339e+00, 5.86880339e+00,
2.30818750e+02],
[2.05457291e+03, 2.19660112e+02, 6.20024969e+00, 6.20024969e+00,
2.26094532e+02],
[2.08457186e+03, 2.14252650e+02, 6.53323083e+00, 6.53323083e+00,
2.15102553e+02],
[2.11457084e+03, 1.96716713e+02, 6.87393629e+00, 6.87393629e+00,
1.98340298e+02],
[2.14456985e+03, 1.76431323e+02, 7.23789713e+00, 7.23789713e+00,
1.78237039e+02],
[2.17456889e+03, 1.52227062e+02, 7.64417922e+00, 7.64417922e+00,
1.58049842e+02],
[2.20456795e+03, 1.38671109e+02, 8.10965997e+00, 8.10965997e+00,
1.40733305e+02],
[2.23456704e+03, 1.21459219e+02, 8.64541703e+00, 8.64541703e+00,
1.28004092e+02],
[2.26456615e+03, 1.16155153e+02, 9.25556670e+00, 9.25556670e+00,
1.20051892e+02],
[2.29456529e+03, 1.17768892e+02, 9.93861339e+00, 9.93861339e+00,
1.15705770e+02],
[2.32456444e+03, 1.16129438e+02, 1.06905048e+01, 1.06905048e+01,
1.13100669e+02],
[2.35456362e+03, 1.09714703e+02, 1.15085752e+01, 1.15085752e+01,
1.10345705e+02],
[2.38456282e+03, 1.20361413e+02, 1.23926722e+01, 1.23926722e+01,
1.06139560e+02],
[2.41456204e+03, 9.04515698e+01, 1.33433129e+01, 1.33433129e+01,
1.00105444e+02],
[2.44456128e+03, 1.03080972e+02, 1.43819739e+01, 1.43819739e+01,
9.26666904e+01],
[2.47456054e+03, 7.36743738e+01, 1.55113561e+01, 1.55113561e+01,
8.48106882e+01],
[2.49902400e+03, 6.13290585e+01, 2.09398269e+01, 2.09398269e+01,
7.87736295e+01]])
lmax = 3000
test_cls_meas_frommap = hp.anafast(map_masked, lmax=lmax, use_pixel_weights=True) #used "use_pixel_weights=True" arg to have a more precise power spectrum
ll = np.arange(lmax+1)
ll
array([ 0, 1, 2, ..., 2998, 2999, 3000])
sky_fraction = len(map_masked.compressed()) / len(map_masked)
print(f"The map covers {sky_fraction:.1%} of the sky")
The map covers 77.9% of the sky
plt.style.use("seaborn-poster") #read more on style used
k2muK = 1e6
Power spectra are generally plotted as $D_\ell$ which is defined as $\dfrac{\ell(\ell+1)}{2 \pi}C_\ell$, so we need to apply that factor to the $C_\ell$ calculated from the map.
plt.plot(cmb_binned_spectrum[:,0], cmb_binned_spectrum[:,1], '--', alpha=1, label='Planck 2018 PS release')
plt.plot(ll, ll*(ll+1.)*test_cls_meas_frommap*k2muK**2/2./np.pi / sky_fraction, '--', alpha=0.6, label='Planck 2018 PS from Data Map')
plt.xlabel(r'$\ell$')
plt.ylabel(r'$D_\ell~[\mu K^2]$')
plt.grid()
plt.legend(loc='best')
<matplotlib.legend.Legend at 0x11004b280>
Reading the documentation of the Planck release we see that the output has a resolution of 5 arcminutes. Therefore as a first order correction of the beam, we can divide the power spectrum by the square of the beam window function.
w_ell = hp.gauss_beam((5*u.arcmin).to_value(u.radian), lmax=lmax)
plt.plot(cmb_binned_spectrum[:,0], cmb_binned_spectrum[:,1], '--', alpha=1, label='Planck 2018 PS release')
plt.plot(ll, ll*(ll+1.)*test_cls_meas_frommap*k2muK**2/2./np.pi / sky_fraction / w_ell**2,
alpha=0.6, label='Planck 2018 PS from Data Map (beam corrected)')
plt.xlabel(r'$\ell$')
plt.ylabel(r'$D_\ell~[\mu K^2]$')
plt.grid()
plt.legend(loc='best');
Intermediate(Getting Clean Map used for analysis)
from pixell import enmap, utils
from astropy.io import fits
from astropy.utils.data import get_pkg_data_filename
from astropy.convolution import Gaussian2DKernel
from scipy.signal import convolve as scipy_convolve
from astropy.convolution import convolve
# Load the data
filename = get_pkg_data_filename('ffp10_newdust_total_030_full_map.fits')
hdu = fits.open(filename)[0]
hdu
<astropy.io.fits.hdu.image.PrimaryHDU at 0x1440f91f0>
from astropy.convolution import Gaussian1DKernel
#the convolution module also includes built-in kernels that can be imported as
gauss = Gaussian1DKernel(stddev=2)
gauss.array
array([6.69151129e-05, 4.36341348e-04, 2.21592421e-03, 8.76415025e-03,
2.69954833e-02, 6.47587978e-02, 1.20985362e-01, 1.76032663e-01,
1.99471140e-01, 1.76032663e-01, 1.20985362e-01, 6.47587978e-02,
2.69954833e-02, 8.76415025e-03, 2.21592421e-03, 4.36341348e-04,
6.69151129e-05])
The kernel can then be used directly when calling convolve()
NSIDE = 1024
print("Approximate resolution at NSIDE {} is {:.2} deg".format(
NSIDE, hp.nside2resol(NSIDE, arcmin=True) / 60
) )
Approximate resolution at NSIDE 1024 is 0.057 deg
NPIX = hp.nside2npix(NSIDE)
print(NPIX)
12582912
getting alms of map(sample) used from Planck
hp.sphtfunc.map2alm(map_sample, lmax=1300, mmax=None, iter=3, pol=True, use_weights=False, datapath=None, gal_cut=0, use_pixel_weights=False)
array([ 1.16211765e-03+0.00000000e+00j, -1.29597927e-05+0.00000000e+00j,
-1.32805698e-03+0.00000000e+00j, ...,
2.49503412e-08-4.73206538e-08j, -1.51505776e-08-3.88394977e-08j,
-2.92800850e-08-3.33140654e-08j])
#pol=false
alm = hp.sphtfunc.map2alm(map_sample, lmax=1300, mmax=None, iter=3, pol=False, use_weights=False, datapath=None, gal_cut=0, use_pixel_weights=False)
alm
array([ 1.16211765e-03+0.00000000e+00j, -1.29597927e-05+0.00000000e+00j,
-1.32805698e-03+0.00000000e+00j, ...,
2.49503412e-08-4.73206538e-08j, -1.51505776e-08-3.88394977e-08j,
-2.92800850e-08-3.33140654e-08j])
" Multiply alm by a function of l. The function is assumed to be zero where not defined.
Parameters almarray The alm to multiply
flarray The function (at l=0..fl.size-1) by which alm must be multiplied.
mmaxNone or int, optional The maximum m defining the alm layout. Default: lmax.
inplacebool, optional If True, modify the given alm, otherwise make a copy before multiplying.
Returns almarray The modified alm, either a new array or a reference to input alm, if inplace is True. "
np.shape(alm)
(846951,)
alm
array([ 1.16211765e-03+0.00000000e+00j, -1.29597927e-05+0.00000000e+00j,
-1.32805698e-03+0.00000000e+00j, ...,
2.49503412e-08-4.73206538e-08j, -1.51505776e-08-3.88394977e-08j,
-2.92800850e-08-3.33140654e-08j])
#fl = w_ell #see power spectra step, deriv of beam function used as fl (function of l)
#hp.sphtfunc.almxfl(alm , fl, mmax=None, inplace=True)
alm
array([ 1.16211765e-03+0.00000000e+00j, -1.29597927e-05+0.00000000e+00j,
-1.32805698e-03+0.00000000e+00j, ...,
2.49503412e-08-4.73206538e-08j, -1.51505776e-08-3.88394977e-08j,
-2.92800850e-08-3.33140654e-08j])
applying a spherical harmonic transform back to map space (hp.alm2map), using Nside = 1024.
#hp.sphtfunc.alm2map(alm, nside=1024, lmax=lmax, mmax=None, pixwin=False, fwhm=0.0, sigma=None, pol=True, inplace=False, verbose=True)
#mmax = 1300
#checking size of alm
#(mmax * (2 * lmax + 1 - mmax)) / (2 + lmax + 1)
#resize alm
#alm_resize= np.resize(alm,2035)
#alm_resize
#pol=false polarisatn
#hp.sphtfunc.alm2map(alm,nside=16, lmax=lmax, mmax=None, pixwin=False, fwhm=0.0, sigma=None, pol=False, inplace=False, verbose=True)
new_map=hp.sphtfunc.alm2map(alm,nside=1024) #, mmax=None, pixwin=False, fwhm=0.0, sigma=None, pol=False, inplace=False, verbose=True)
new_map
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/sphtfunc.py:822: UserWarning: Sigma is 0.000000 arcmin (0.000000 rad) warnings.warn( /opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/sphtfunc.py:827: UserWarning: -> fwhm is 0.000000 arcmin warnings.warn(
array([-0.00018566, -0.00016411, -0.00019511, ..., -0.00013042,
-0.0001177 , -0.0001039 ])
np.shape(new_map)
(12582912,)
np.shape(alm)
(846951,)
np.shape(map_sample)
(12582912,)
hp.mollview(
new_map,
coord=["G"], #galactic only
title="Visualised sample-New Map",
unit="mK",
norm="hist",
min=-0.01,
max=0.01,
)
hp.graticule()
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:920: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_over(newcm(1.0))
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:921: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_under(bgcolor)
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:922: MatplotlibDeprecationWarning: You are modifying the state of a globally registered colormap. This has been deprecated since 3.3 and in 3.6, you will not be able to modify a registered colormap in-place. To remove this warning, you can make a copy of the colormap first. cmap = mpl.cm.get_cmap("viridis").copy()
newcm.set_bad(badcolor)
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:202: MatplotlibDeprecationWarning: Passing parameters norm and vmin/vmax simultaneously is deprecated since 3.3 and will become an error two minor releases later. Please pass vmin/vmax directly to the norm when creating it.
aximg = self.imshow(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:541: UserWarning: 0.0 180.0 -180.0 180.0
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:656: UserWarning: The interval between parallels is 30 deg -0.00'.
warnings.warn(
/opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/projaxes.py:664: UserWarning: The interval between meridians is 30 deg -0.00'.
warnings.warn(
hp.mollview(
map_sample,
coord=["G"],
title="Histogram equalized Galactic Sample 30Hz",
unit="mK",
norm="hist",
min=-0.01,
max=0.01,
)
hp.graticule()
hp.mollview(
map_sample - new_map,
coord=["G"],
title="Map Difference Galactic Sample 30Hz",
unit="mK",
norm="hist",
#min=-0.0,
#max=0.01,
)
hp.graticule()
Changing lmax
alm_mod = hp.sphtfunc.map2alm(map_sample, lmax=2600, mmax=None, iter=3, pol=False, use_weights=False, datapath=None, gal_cut=0, use_pixel_weights=False)
alm_mod
array([ 1.16211765e-03+0.00000000e+00j, -1.29597994e-05+0.00000000e+00j,
-1.32805698e-03+0.00000000e+00j, ...,
-1.51605391e-08-1.73595460e-08j, 6.38411379e-08-6.22820691e-09j,
-1.39033637e-08+4.38978354e-08j])
new_map_mod=hp.sphtfunc.alm2map(alm,nside=1024) #, mmax=None, pixwin=False, fwhm=0.0, sigma=None, pol=False, inplace=False, verbose=True)
new_map_mod
array([-0.00018566, -0.00016411, -0.00019511, ..., -0.00013042,
-0.0001177 , -0.0001039 ])
hp.mollview(
new_map_mod,
coord=["G"],
title="Map Difference Galactic Sample 30Hz",
unit="mK",
norm="hist",
#min=-0.0,
#max=0.01,
)
hp.graticule()
hp.mollview(
map_sample - new_map_mod,
coord=["G"],
title="Map Difference Galactic Sample 30Hz",
unit="mK",
norm="hist",
#min=-0.0,
#max=0.01,
)
hp.graticule()
hp.mollview(
new_map- new_map_mod,
coord=["G"],
title="Map Difference Galactic Sample 30Hz",
unit="mK",
norm="hist",
#min=-1,
#max=1,
)
hp.graticule()
from scipy.stats import multivariate_normal
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from numpy.linalg import multi_dot
import matplotlib.pyplot as plt
def doplt(arr2d,cmap='gray',**kwargs): return(plt.imshow(arr2d,cmap=cmap,**kwargs))
from scipy.linalg import eigh
d=9 # num of features / dimension of problem
mean = np.arange(d).tolist()
cov = np.arange(1,d+1)*np.eye(d)
y = multivariate_normal(mean=mean,
cov=cov
)
cov
array([[1., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 2., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 3., 0., 0., 0., 0., 0., 0.],
[0., 0., 0., 4., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 5., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 6., 0., 0., 0.],
[0., 0., 0., 0., 0., 0., 7., 0., 0.],
[0., 0., 0., 0., 0., 0., 0., 8., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 9.]])
np.random.seed(0)
num_samples = 9*12582912 #12582912=NPIX
samples = y.rvs(size=num_samples) # number of samples
samples.mean(0)
samples.shape
(113246208, 9)
N, d = samples.shape
cov = np.zeros((d,d))
for idx_r in range(d):
for idx_c in range(d):
if idx_c >= idx_r:
x = samples[:,idx_r]
y = samples[:,idx_c]
Ex = x.mean()
Ey = y.mean()
cov_xy = ((x-Ex)*(y-Ey)).mean()
cov[idx_r,idx_c] = cov_xy
if idx_c != idx_r: cov[idx_c,idx_r] = cov_xy
cov
array([[ 9.99947634e-01, -1.80054627e-04, -1.51572760e-04,
-1.87966597e-04, -1.89954108e-04, -2.18025181e-06,
-1.40653085e-04, -3.10620432e-04, 3.17202687e-04],
[-1.80054627e-04, 2.00032196e+00, 8.08604853e-05,
8.47303045e-05, 2.72691542e-04, -4.35252057e-06,
7.94985375e-05, 6.76969708e-04, -2.38873314e-05],
[-1.51572760e-04, 8.08604853e-05, 2.99960042e+00,
-8.98349039e-05, 5.03434184e-04, 2.03966723e-04,
7.28318951e-04, -5.43813174e-04, 8.62101538e-05],
[-1.87966597e-04, 8.47303045e-05, -8.98349039e-05,
3.99994673e+00, 1.14330578e-03, -3.60371649e-04,
-2.16260358e-04, 6.88066077e-05, 7.65047684e-04],
[-1.89954108e-04, 2.72691542e-04, 5.03434184e-04,
1.14330578e-03, 4.99944067e+00, -4.77471403e-04,
3.27993833e-04, -3.01029476e-06, 1.94070750e-04],
[-2.18025181e-06, -4.35252057e-06, 2.03966723e-04,
-3.60371649e-04, -4.77471403e-04, 5.99976589e+00,
-9.23806634e-04, 5.18173348e-04, -1.91943451e-03],
[-1.40653085e-04, 7.94985375e-05, 7.28318951e-04,
-2.16260358e-04, 3.27993833e-04, -9.23806634e-04,
6.99861391e+00, -2.50487709e-05, 8.63985962e-04],
[-3.10620432e-04, 6.76969708e-04, -5.43813174e-04,
6.88066077e-05, -3.01029476e-06, 5.18173348e-04,
-2.50487709e-05, 8.00001663e+00, -1.13070270e-04],
[ 3.17202687e-04, -2.38873314e-05, 8.62101538e-05,
7.65047684e-04, 1.94070750e-04, -1.91943451e-03,
8.63985962e-04, -1.13070270e-04, 9.00122239e+00]])
np.shape(cov)
(9, 9)
cov_inv = np.linalg.inv(cov) #inverse
cov_inv
array([[ 1.00005244e+00, 8.99939748e-05, 5.05293890e-05,
4.69903053e-05, 3.79764286e-05, 3.56065349e-07,
2.00962601e-05, 3.88244804e-05, -3.52482276e-05],
[ 8.99939748e-05, 4.99919550e-01, -1.34739221e-05,
-1.05778066e-05, -2.72602918e-05, 3.63555379e-07,
-5.67478324e-06, -4.23010746e-05, 1.32521555e-06],
[ 5.05293890e-05, -1.34739221e-05, 3.33377759e-01,
7.49691743e-06, -3.35682369e-05, -1.13439703e-05,
-3.46913954e-05, 2.26654610e-05, -3.19349481e-06],
[ 4.69903053e-05, -1.05778066e-05, 7.49691743e-06,
2.50003354e-01, -5.71690948e-05, 1.50060566e-05,
7.73277718e-06, -2.14827120e-06, -2.12468162e-05],
[ 3.79764286e-05, -2.72602918e-05, -3.35682369e-05,
-5.71690948e-05, 2.00022398e-01, 1.59129921e-05,
-9.36872623e-06, 7.61359301e-08, -4.30451714e-06],
[ 3.56065349e-07, 3.63555379e-07, -1.13439703e-05,
1.50060566e-05, 1.59129921e-05, 1.66673188e-01,
2.19970888e-05, -1.07960180e-05, 3.55378785e-05],
[ 2.00962601e-05, -5.67478324e-06, -3.46913954e-05,
7.73277718e-06, -9.36872623e-06, 2.19970888e-05,
1.42885445e-01, 4.44600854e-07, -1.37110671e-05],
[ 3.88244804e-05, -4.23010746e-05, 2.26654610e-05,
-2.14827120e-06, 7.61359301e-08, -1.07960180e-05,
4.44600854e-07, 1.24999748e-01, 1.56634258e-06],
[-3.52482276e-05, 1.32521555e-06, -3.19349481e-06,
-2.12468162e-05, -4.30451714e-06, 3.55378785e-05,
-1.37110671e-05, 1.56634258e-06, 1.11096034e-01]])
Algorithm calculates the covariance matrix, element by element
$\sigma^2_{xy}=cov(x,y) = E\big[(x-E[x]) (y-E[y])\big] = 1/N\sum_{i=1}^N(x_i-E[x])(y_i-E[y])$
source: https://github.com/geoffwoollard/learn_cryoem_math/blob/master/nb/covariance.ipynb
plt.imshow(cov,cmap='viridis')
<matplotlib.image.AxesImage at 0x147907f40>
$ w_{l} = \frac{C^{-1} e }{e^{t} C^{-1} e} $ where C is covariance matrix (9x9 in our case)
e = np.array([1,1,1,1,1,1,1,1,1])
e
array([1, 1, 1, 1, 1, 1, 1, 1, 1])
e_T = e.transpose()
e_T
array([1, 1, 1, 1, 1, 1, 1, 1, 1])
e_T == e
array([ True, True, True, True, True, True, True, True, True])
w_l = (cov_inv*e)/(e_T*cov_inv*e)
w_l
array([[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1.]])
convolved_map=convolve(new_map, gauss.array)
convolved_map
array([-1.11504493e-04, -1.46742285e-04, -1.72289037e-04, ...,
-1.01749548e-04, -8.86669352e-05, -6.83459016e-05])
gauss.array
array([6.69151129e-05, 4.36341348e-04, 2.21592421e-03, 8.76415025e-03,
2.69954833e-02, 6.47587978e-02, 1.20985362e-01, 1.76032663e-01,
1.99471140e-01, 1.76032663e-01, 1.20985362e-01, 6.47587978e-02,
2.69954833e-02, 8.76415025e-03, 2.21592421e-03, 4.36341348e-04,
6.69151129e-05])
new_map
array([-0.00018566, -0.00016411, -0.00019511, ..., -0.00013042,
-0.0001177 , -0.0001039 ])
hp.mollview(
convolved_map,
coord=["G"],
title="Convolved Map Sample",
unit="mK",
norm="hist",
min=-0.01,
max=0.01,
)
hp.graticule()
NPIX
12582912
new_convolvedmap= np.resize(convolved_map,(9,9))
new_convolvedmap
array([[-0.0001115 , -0.00014674, -0.00017229, -0.00018555, -0.00018832,
-0.00018552, -0.00018337, -0.00018657, -0.00019591],
[-0.00020807, -0.00021773, -0.00022075, -0.00021608, -0.00020566,
-0.00019312, -0.00018245, -0.00017714, -0.00017934],
[-0.00018903, -0.0002038 , -0.00021972, -0.00023275, -0.00024019,
-0.00024121, -0.00023651, -0.00022751, -0.00021561],
[-0.00020195, -0.000188 , -0.00017613, -0.0001692 , -0.00016925,
-0.00017636, -0.00018874, -0.00020354, -0.00021782],
[-0.00022948, -0.00023776, -0.00024286, -0.00024495, -0.0002438 ,
-0.00023918, -0.00023126, -0.00022028, -0.0002064 ],
[-0.00019026, -0.00017385, -0.0001604 , -0.00015293, -0.00015272,
-0.00015904, -0.00017004, -0.0001836 , -0.00019729],
[-0.00020867, -0.00021646, -0.00022155, -0.00022632, -0.00023227,
-0.00023839, -0.00024195, -0.00024089, -0.00023506],
[-0.00022548, -0.00021306, -0.00019809, -0.00018097, -0.00016304,
-0.00014688, -0.00013553, -0.00013096, -0.00013312],
[-0.00014047, -0.00015143, -0.00016498, -0.00017979, -0.00019344,
-0.00020309, -0.00020732, -0.0002076 , -0.00020789]])
cleaner_hope = (cov)*new_convolvedmap
cleaner_hope
array([[-1.11498654e-04, 2.64216275e-08, 2.61143250e-08,
3.48777521e-08, 3.57714286e-08, 4.04490383e-10,
2.57921260e-08, 5.79512891e-08, -6.21443055e-08],
[ 3.74636279e-08, -4.35530093e-04, -1.78500018e-08,
-1.83083642e-08, -5.60818562e-08, 8.40554336e-10,
-1.45045315e-08, -1.19920718e-07, 4.28403362e-09],
[ 2.86516863e-08, -1.64797600e-08, -6.59059779e-04,
2.09088630e-08, -1.20920219e-07, -4.91984154e-08,
-1.72252527e-07, 1.23725100e-07, -1.85878289e-08],
[ 3.79598554e-08, -1.59293017e-08, 1.58223692e-08,
-6.76796960e-04, -1.93500739e-07, 6.35536917e-08,
4.08165362e-08, -1.40048847e-08, -1.66643658e-07],
[ 4.35903731e-08, -6.48349949e-08, -1.22263105e-07,
-2.80054040e-07, -1.21885190e-03, 1.14202017e-07,
-7.58508858e-08, 6.63103067e-10, -4.00557443e-08],
[ 4.14814789e-10, 7.56698227e-10, -3.27155807e-08,
5.51105415e-08, 7.29216424e-08, -9.54206949e-04,
1.57087226e-07, -9.51350011e-08, 3.78678981e-07],
[ 2.93502088e-08, -1.72081131e-08, -1.61360081e-07,
4.89441899e-08, -7.61835682e-08, 2.20221850e-07,
-1.69331788e-03, 6.03405942e-09, -2.03085404e-07],
[ 7.00401958e-08, -1.44236010e-07, 1.07725862e-07,
-1.24520306e-08, 4.90809719e-10, -7.61117643e-08,
3.39477877e-09, -1.04767790e-03, 1.50522192e-08],
[-4.45566078e-08, 3.61717643e-09, -1.42229263e-08,
-1.37551513e-07, -3.75415797e-08, 3.89817344e-07,
-1.79122617e-07, 2.34731217e-08, -1.87122182e-03]])
cleaner_hope==cov
array([[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False],
[False, False, False, False, False, False, False, False, False]])
cleaner_hope
array([[-1.11498654e-04, 2.64216275e-08, 2.61143250e-08,
3.48777521e-08, 3.57714286e-08, 4.04490383e-10,
2.57921260e-08, 5.79512891e-08, -6.21443055e-08],
[ 3.74636279e-08, -4.35530093e-04, -1.78500018e-08,
-1.83083642e-08, -5.60818562e-08, 8.40554336e-10,
-1.45045315e-08, -1.19920718e-07, 4.28403362e-09],
[ 2.86516863e-08, -1.64797600e-08, -6.59059779e-04,
2.09088630e-08, -1.20920219e-07, -4.91984154e-08,
-1.72252527e-07, 1.23725100e-07, -1.85878289e-08],
[ 3.79598554e-08, -1.59293017e-08, 1.58223692e-08,
-6.76796960e-04, -1.93500739e-07, 6.35536917e-08,
4.08165362e-08, -1.40048847e-08, -1.66643658e-07],
[ 4.35903731e-08, -6.48349949e-08, -1.22263105e-07,
-2.80054040e-07, -1.21885190e-03, 1.14202017e-07,
-7.58508858e-08, 6.63103067e-10, -4.00557443e-08],
[ 4.14814789e-10, 7.56698227e-10, -3.27155807e-08,
5.51105415e-08, 7.29216424e-08, -9.54206949e-04,
1.57087226e-07, -9.51350011e-08, 3.78678981e-07],
[ 2.93502088e-08, -1.72081131e-08, -1.61360081e-07,
4.89441899e-08, -7.61835682e-08, 2.20221850e-07,
-1.69331788e-03, 6.03405942e-09, -2.03085404e-07],
[ 7.00401958e-08, -1.44236010e-07, 1.07725862e-07,
-1.24520306e-08, 4.90809719e-10, -7.61117643e-08,
3.39477877e-09, -1.04767790e-03, 1.50522192e-08],
[-4.45566078e-08, 3.61717643e-09, -1.42229263e-08,
-1.37551513e-07, -3.75415797e-08, 3.89817344e-07,
-1.79122617e-07, 2.34731217e-08, -1.87122182e-03]])
b = cleaner_hope.flatten()
b
array([-1.11498654e-04, 2.64216275e-08, 2.61143250e-08, 3.48777521e-08,
3.57714286e-08, 4.04490383e-10, 2.57921260e-08, 5.79512891e-08,
-6.21443055e-08, 3.74636279e-08, -4.35530093e-04, -1.78500018e-08,
-1.83083642e-08, -5.60818562e-08, 8.40554336e-10, -1.45045315e-08,
-1.19920718e-07, 4.28403362e-09, 2.86516863e-08, -1.64797600e-08,
-6.59059779e-04, 2.09088630e-08, -1.20920219e-07, -4.91984154e-08,
-1.72252527e-07, 1.23725100e-07, -1.85878289e-08, 3.79598554e-08,
-1.59293017e-08, 1.58223692e-08, -6.76796960e-04, -1.93500739e-07,
6.35536917e-08, 4.08165362e-08, -1.40048847e-08, -1.66643658e-07,
4.35903731e-08, -6.48349949e-08, -1.22263105e-07, -2.80054040e-07,
-1.21885190e-03, 1.14202017e-07, -7.58508858e-08, 6.63103067e-10,
-4.00557443e-08, 4.14814789e-10, 7.56698227e-10, -3.27155807e-08,
5.51105415e-08, 7.29216424e-08, -9.54206949e-04, 1.57087226e-07,
-9.51350011e-08, 3.78678981e-07, 2.93502088e-08, -1.72081131e-08,
-1.61360081e-07, 4.89441899e-08, -7.61835682e-08, 2.20221850e-07,
-1.69331788e-03, 6.03405942e-09, -2.03085404e-07, 7.00401958e-08,
-1.44236010e-07, 1.07725862e-07, -1.24520306e-08, 4.90809719e-10,
-7.61117643e-08, 3.39477877e-09, -1.04767790e-03, 1.50522192e-08,
-4.45566078e-08, 3.61717643e-09, -1.42229263e-08, -1.37551513e-07,
-3.75415797e-08, 3.89817344e-07, -1.79122617e-07, 2.34731217e-08,
-1.87122182e-03])
hp.mollview(
b,
coord=["G"],
title="Convolved Map Sample",
unit="mK",
norm="hist",
min=-0.01,
max=0.01,
)
hp.graticule()
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-179-fe5b43321f75> in <module> ----> 1 hp.mollview( 2 b, 3 coord=["G"], 4 title="Convolved Map Sample", 5 unit="mK", /opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/visufunc.py in mollview(map, fig, rot, coord, unit, xsize, title, nest, min, max, flip, remove_dip, remove_mono, gal_cut, format, format2, cbar, cmap, badcolor, bgcolor, notext, norm, hold, reuse_axes, margins, sub, nlocs, return_projected_map) 189 190 # Ensure that the nside is valid --> 191 nside = pixelfunc.get_nside(map) 192 pixelfunc.check_nside(nside, nest=nest) 193 /opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/pixelfunc.py in get_nside(m) 1793 a TypeError exception is raised. 1794 """ -> 1795 typ = maptype(m) 1796 if typ == 0: 1797 return npix2nside(len(m)) /opt/anaconda3/envs/act_notebooks/lib/python3.9/site-packages/healpy/pixelfunc.py in maptype(m) 234 return 0 235 else: --> 236 raise TypeError("bad number of pixels") 237 238 TypeError: bad number of pixels